public class LeetCode344 {
    public void reverseString(char[] s) {
        int startIndex = 0;
        int endIndex = s.length - 1;
        while (startIndex < endIndex){
            char temp;

            temp = s[startIndex];
            s[startIndex] = s[endIndex];
            s[endIndex] = temp;

            startIndex++;
            endIndex--;
        }

        for (char c:s){
            System.out.print(c + " ");
        }
    }

    public void reverseString1(char[] s) {
        char temp;
        for(int i = 0,j = s.length - 1; i < j; i++, j--){
            temp = s[i];
            s[i] = s[j];
            s[j] = temp;
        }
    }
}
